﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Reflection;

namespace Fawcett.Plugins
{
    public class CPlugin : IPlugin
    {

        private Assembly assembly;

        public CPlugin()
        {
            assembly = Assembly.GetCallingAssembly();

        }

        public Form parent { get; set; }

        public virtual TabLocation Location { get { return TabLocation.OWN; } }

        public virtual RibbonTab SetupMenu(RibbonTab HomeTab)
        {

            return null;
        }

        public string Name
        {
            get
            {
                AssemblyTitleAttribute assemblyTitle = assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false)[0] as AssemblyTitleAttribute;
                return assemblyTitle.Title;
            }
        }

        public string Version { get { return assembly.GetName().Version.ToString(); } }

        public string Description
        {
            get
            {
                AssemblyDescriptionAttribute assemblyDesc = assembly.GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false)[0] as AssemblyDescriptionAttribute;
                return assemblyDesc.Description;
            }
        }

        public virtual void PluginEventHandler(object sender, EPlugin p)
        {
            Console.WriteLine(Name + " (CPlugin) Has Caught Event ({0})", p.GetInfo);
        }

    }

}
